/****************************************************************
 *  This file created by writerB.php on 03/26/2007 at 15:59:40  *
 ****************************************************************
 *  writerB.php created by Tonk (tonk@ctonk.com) in 2007        *
 ****************************************************************
 *                 General Document Information
 *
 *  File Name: help.cpp
 *  Class Name: Help
 *  Data members: 3
 *  Notes:
 ****************************************************************/

#include <iostream>
#include "help.h"
#include "stringutil.h"



int Help::numHelps = 0;
int Help::helpIndex = 0;


// Default constructor...
Help::Help() {
	setHelpID( ++helpIndex );
	// Increment the object count...
	numHelps++;
}

// Additional constructors...

// Copy constructor (Doesn't change _HelpID)...
Help::Help( const Help& ref ) {
	setHelpID( ++helpIndex );
	setTitle( ref.getTitle() );
	setTags( ref.getTags() );
	setText( ref.getText() );
	setLevel( ref.getLevel() );
	// Increment the object count...
	numHelps++;
}

// Destructor...
Help::~Help() {
	// Decrement the object count...
	numHelps--;
}

// Assignment operator (Doesn't change _HelpID)...
Help& Help::operator = ( const Help& ref ) {
	setTitle( ref.getTitle() );
	setTags( ref.getTags() );
	setText( ref.getText() );
	setLevel( ref.getLevel() );
	return *this;
}

// Equality operator (Doesn't compare _HelpID)...
bool Help::operator == ( const Help& ref ) const {
	return	(
		   getTitle() == ref.getTitle()
		&& getTags() == ref.getTags()
		&& getText() == ref.getText()
		&& getLevel() == ref.getLevel()
		);
}

// Less than operator (Compares _HelpID)...
bool Help::operator < ( const Help& ref ) const {
	return ( getHelpID() < ref.getHelpID() );
}

// Greater than operator (Compares _HelpID)...
bool Help::operator > ( const Help& ref ) const {
	return ( getHelpID() > ref.getHelpID() );
}

// Protected Methods...
void Help::setHelpID( const int& HelpID ) { // protected
	_HelpID = HelpID;
}

// Public accessor methods...
int Help::getHelpID( void ) const { // public
	return _HelpID;
}

void Help::setTitle( const std::string& title ) { // public
	_title = title;
	return;
}

std::string Help::getTitle( void ) const { // public
	return _title;
}

void Help::setTags( const std::string& tags ) { // public
	_tags = tags;
	return;
}

std::string Help::getTags( void ) const { // public
	return _tags;
}

void Help::setText( const std::string& text ) { // public
	_text = text;
	return;
}

std::string Help::getText( void ) const { // public
	return _text;
}

void Help::setLevel( const unsigned& level ) { // public
	_level = level;
	return;
}

unsigned Help::getLevel( void ) const { // public
	return _level;
}

// General methods...

// Static methods...

// Associated operators...
std::ostream& operator << ( std::ostream& write, Help& help ) { // associated
	write << "HelpID:\t" << help.getHelpID() << "\n";
	write << "title:\t" << help.getTitle() << "\n";
	write << "tags:\t" << help.getTags() << "\n";
	write << "text:\t" << help.getText() << "\n";
	write << "level:\t" << help.getLevel() << "\n";
	return write;
}

std::ostream& operator << ( std::ostream& write, Help* help ) { // associated
	return ( write << (*help) );
}

std::string& operator << ( std::string& dest, Help* help ) { // associated
	dest << " ------------------------------------------------------------------------------\n\r";
	dest << "\t\t\t\t{!W" << help->getTitle() << "{x\n\r";
	dest << "Tags: {c" << help->getTags() << "{x\n\r\n\r";
	dest << help->getText() << "{x\n\r";
	return dest;
}

